package com.machine.action.order;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.machine.service.order.PriceOrderServer;
import com.opensymphony.xwork2.ActionSupport;

@Component("deletePriceOrderAction")
@Scope(value = "prototype")
public class DeletePriceOrderAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private PriceOrderServer priceOrderServer;
	private List<Integer> id = new ArrayList<Integer>();

	public PriceOrderServer getPriceOrderServer() {
		return priceOrderServer;
	}

	@Resource
	public void setPriceOrderServer(PriceOrderServer priceOrderServer) {
		this.priceOrderServer = priceOrderServer;
	}

	public List<Integer> getId() {
		return id;
	}

	public void setId(List<Integer> id) {
		this.id = id;
	}

	@Override
	public String execute() throws Exception {
		
		if(id.size() > 0){
			priceOrderServer.deleteByIdList(id);
		}
		return super.execute();
	}

}
